package com.share.pattern;

import java.util.Scanner;

/**
 * 
 * @author Johnny Tam
 *
 *         面向对象方式编写
 *         暂时只有 + ， -
 */
public class CalculatorDemoV03 {

	public static void main(String[] args) {
		/**
		 * v0.3 面向对象编程 
		 * 客户端代码
		 */
		try {

			Scanner input = new Scanner(System.in);
			System.out.println("请输入数字A： ");
			double numberA = input.nextDouble();

			System.out.println("请选择运算符号(+, -)： ");
			String strOperate = input.next();

			System.out.println("请输入数字B： ");
			double numberB = input.nextDouble();

			// System.out.println(numberA + "\t" + strOperte + "\t" + numberB);

			double result = 0;
			result = CalculatorOperation.getResult(numberA, numberB, strOperate);

			System.out.println("结果是： " + result);
			
		} catch (Exception e) {
			System.out.println("您的输入有错误：" + e.getMessage());
		}

	}

}
